import os, sys, re,csv
import requests
import requests_ftp
from lxml import etree
cwd = os.getcwd()
sys.path.append(cwd)

def get_data_url(url):
    requests_ftp.monkeypatch_session()
    s = requests.Session()
    res = s.list(url = url, auth=('zhang22400228_163.com', 'SP+wari8'))
    res.encoding = 'utf-8'
    print(res.text)




if __name__ == '__main__':
    url = 'ftp://ftp.ptree.jaxa.jp/jma/netcdf'
    headers = {'Connection': 'keep-alive',
              'Cache-Control': 'max-age=0',
              'Upgrade-Insecure-Requests': '1',
              'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko)',
              'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
              'Accept-Encoding': 'gzip, deflate, sdch',
              'Accept-Language': 'zh-CN,zh;q=0.8',
              }
    get_data_url(url)

